package org.libraq.hrm.fallback;

import feign.hystrix.FallbackFactory;
import org.libraq.hrm.doc.CourseDoc;
import org.libraq.hrm.feign.CourseFeignClient;
import org.libraq.hrm.util.AjaxResult;
import org.springframework.stereotype.Component;

@Component
public class CourseFeignClientFallbackFactory implements FallbackFactory<CourseFeignClient> {
    @Override
    public CourseFeignClient create(Throwable throwable) {
        return new CourseFeignClient() {
            @Override
            public AjaxResult save(CourseDoc doc) {
                return AjaxResult.me().setSuccess(false).setMessage("Es服务降级了。。。");
            }
        };
    }
}